<div class="row">
  <div id="aflkj" class="col-sm-12">
    <script type="text/javascript" src="/js/sorttable.js"></script>
    <style>
    /* Sortable tables */
    table.sortable {
      width: 100%;
      border: 0;
      table-layout:fixed;
      word-wrap:break-word;
      border-collapse:collapse;
    }

    table.sortable thead {
        background-color:#eee;
        color:#666666;
        font-weight: bold;
        cursor: default;
    }
    </style>
    <p></p>
    <table id="webapps" class="sortable" border="1" width=100%>
      <colgroup>
        <col style="width:20%">
        <col style="width:20%">
        <col style="width:20%">
        <col style="width:20%">
        <col style="width:10%">
        <col style="width:5%">
        <col style="width:5%">
      </colgroup>
      <tbody>
      <tr><th>Screenshots</th><th>Names</th><th>Host</th><th>Products</th><th>JQuery</th><th>Verbs</th><th>API</th></tr>
      <% @alias_groups.each do |g| %>
        <% entities = Intrigue::Model::Entity.where(:alias_group_id => g.id, :type => "Intrigue::Entity::Uri", :hidden => false) %>
        <% next unless entities.count > 0 %>
        <tr>
          <td>
            <% entities.map do |x| %>
              <% if x.has_detail('hidden_screenshot_contents') %>
                <%= "<a href='/#{h @project_name}/entities/#{x.id}'>"%>
                  <img height=200 width=240 src="data:image/png;base64, <%= h x.get_detail('hidden_screenshot_contents') %>" alt="Screenshot" />
                </a>
              <% end %>
            <% end %>
          </td>
          <td>
            <% entities.map do |x| %>
              <%= "<a href='/#{h @project_name}/entities/#{h x.id}'>#{x.name}<br/>" %>
            <% end %>
          </td>
          <td>
            <% entities.map do |x| %>
              <% z = Intrigue::Model::Entity.first(:id => x.get_detail("host_id")) %>
              <%= "<a href='/#{h @project_name}/entities/#{h z.id}'>#{h z}<br/>" if z && z.type == "Intrigue::Entity::IpAddress" %>
            <% end %>
          </td>
          <td>
            <% entities.map do |x| %>
              <% products = x.get_detail("products") %>
              <%= "#{h products.map{|x| x["matched"] if x } if products && products.count > 0 }<br/>" %>
            <% end %>
          </td>
          <td>
            <% entities.map do |x| %>
              <%= "#{h x.get_detail("verbs")}<br/>" %>
            <% end %>
          </td>
          <td>
            <% entities.map do |x| %>
              <%= "#{h x.get_detail("jquery")}<br/>" %>
            <% end %>
          </td>
          <td>
            <% entities.map do |x| %>
              <%= x.type_string == "Uri" ? "#{h x.get_detail("api_endpoint")}<br/>" : nil %>
            <% end %>
          </td>
        </tr>
      <% end %>
      </tbody>
    </table>
</div>
</div>
